﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using EasyClassUI.forms.main;
using EasyClassUI.entity;
using EasyClassUI.WebRequest;

namespace EasyClassUI.forms.me
{
    public partial class meUC : UserControl
    {
        public meUC()
        {
            InitializeComponent();
            initMessages();
            groupCountLabel.Text = StudyGroup.GroupICreated.Count.ToString();
            PostService postService = new PostService();
            blogCountLabel.Text = postService.QueryPostsByUser(User.CurrentUser.Token).Posts.Length.ToString();
            NameLabel.Text = User.CurrentUser.UserAccount;
        }
        public void initMessages()
        {
            // 初始化消息列表
            foreach(string msg in User.Message)
            {
                Message message = new Message(msg);
                messagePanel.Controls.Add(message);
            }
        }

        private void blogsCountTitleLabel_Click(object sender, EventArgs e)
        {

        }

        private void guna2Button2_Click(object sender, EventArgs e)
        {
            LoginWindow loginWindow = new LoginWindow();
            loginWindow.Show();
        }
    }
}
